#!/bin/sh

echo "*** Process for HIAWATHA service ***"

## tricky detect if hiawatha as web server
if [ "$(grep 'hiawatha' /usr/local/lxlabs/kloxo/etc/slavedb/driver)" == "" ] ; then
	chkconfig hiawatha off
	if [ "$(service hiawatha status|grep '(pid')" == "" ] ; then
		/etc/init.d/hiawatha stop >/dev/null 2>&1
	fi
else
	chkconfig hiawatha on
fi

if [ ! -f /var/run/hiawatha.pid ] ; then
	if [ -f /var/lock/subsys/hiawatha ] ; then
		'rm' -f /var/lock/subsys/hiawatha
	fi
fi

echo "  - Process: restart"
/etc/rc.d/init.d/hiawatha stop
#pkill -9 hiawatha
/etc/rc.d/init.d/hiawatha start
